<link rel="stylesheet" href="__STATIC__/chosen/chosen.min.css">
<style>
    .layui-rate .layui-inline {
        margin: 0px;
    }
    .rate {
        height: 38px;
        margin-top: -4px;
    }
    .area-chose {
        display: none !important;
    }
    .removeHtml:hover{
        cursor: pointer;
        color: red;
    }
</style>
<fieldset class="layui-elem-field">
    <legend>添加子账号</legend>
    <div class="layui-field-box">
        <form class="layui-form ajax-form" method="post" style="margin: 20px">
            <div class="layui-row">
                <div class="layui-col-md6">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">账号名称</label>
                            <div class="layui-input-inline">
                                <input type="text" name="name" placeholder="账号名称" value="" maxlength="20"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                   、<div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">密码</label>
                            <div class="layui-input-inline">
                                <input type="text" name="password" placeholder="密码" value="" maxlength="20"
                                       autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">子账号所属地址</label>
                        <div class="layui-input-inline">
                            <select name="sheng" lay-filter="test">
                                <option value="">请选择省</option>
                                {volist name="area" id="o"}
                                <option value="{$o.area_id}">{$o.area_name}</option>
                                {/volist}
                            </select>
                        </div>
                        <div class="layui-input-inline">
                            <select name="shi" id="shi">
                            </select>
                        </div>
                    </div>


                <div class="layui-form-item ">
                    <label class="layui-form-label"> </label>
                    <button class="layui-btn" lay-filter="ajax">确定</button>
                </div>
        </form>
    </div>
</fieldset>

<script src="__STATIC__/chosen/chosen.jquery.min.js"></script>
<!-- 配置文件 -->
<script type="text/javascript" src="__STATIC__/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__STATIC__/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->

<script type="text/javascript">

    layui.use(['element', 'table', 'layer', 'form', 'upload','laydate'], function () {
        var upload = layui.upload;
        var layer = layui.layer;
        var form = layui.form;
        var laydate = layui.laydate;
        //广告图片
        form.on('select(test)', function(data){
            console.log(data.value);
            $.ajax({
                url:"{:url('getarea')}",
                data:{
                    area_id:data.value,
                },
                type:'get',
                success:function (res) {
                    var list='';
                    for(var i=0;i<res.data.length;i++){
                        console.log(res.data[i].area_id);
                        list+='<option value="'+res.data[i].area_id+'">'+res.data[i].area_name+'</option>';
                    }
                    $('#shi').append(list);
                    form.render('select');
                }
            })
        });
    })
</script>